package cn.ztw.downgrade;


import cn.ztw.domain.User;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @BelongsProject: springcloudalibaba-parent
 * @BelongsPackage: cn.itsource.downgrade
 * @Author: Director
 * @CreateTime: 2022-07-30  23:30
 * @Description: 服务降级类
 * @Version: 1.0
 */
public class FuseDowngradeUtil {

    /*
     * @Description: 熔断降级方法
     * @Author: Director
     * @Date: 2022/7/31 1:50
     * @param id:
     * @param e: 降级异常
     * @return: cn.itsource.domain.User
     **/
    public static User fuseDegradation(@PathVariable("id") Long id, Throwable  e){
        e.printStackTrace();
        return new User(-1L, "熔断服务降级触发！", "服务不可用，请稍后重试！");
    }

}